<?php
namespace Home\Model;
use Think\Model;

class NavModel extends Model {
    
    public function list_level($arr,$pid=0,$level=0){


        static $data = array();
        foreach($arr as $k => $v){
            if($v['pid'] == $pid){

                $v['level'] = $level;
                $this->list_level($arr,$v['id'],$level+1);
                $data[] = $v;
            }
        }
        return $data;
        }
      
        
     
}